package com.sugou.model.datas;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.sugou.model.core.base.LongIdEntity;
import com.sugou.model.datas.embeddable.Address;
import com.sugou.model.datas.embeddable.Business;
import com.sugou.model.datas.embeddable.Contacts;
import com.sugou.model.datas.embeddable.Point;

@Entity(name="Merchants")
@Table(name="GW_MERCHANTS")
public class Merchants extends LongIdEntity {
	private static final long serialVersionUID = -4062256536818467739L;
	
	@Column(length=1000,nullable=false)
	private String name;
	
	@ManyToOne(cascade={CascadeType.ALL},fetch=FetchType.LAZY)
	@JoinColumn(nullable=false,name="TYPE_ID")
	private MerchantType type;
	
	@Embedded
	private Point point;
	
	@Embedded
	private Address address;
	
	@Embedded
	private Contacts contacts;
	
	@Embedded
	private Business business;

	@OneToMany(cascade={CascadeType.ALL},fetch=FetchType.LAZY,targetEntity=ServerRelation.class,mappedBy="merchants")
	private List<ServerRelation> serverRelations;
	
	@OneToMany(cascade={CascadeType.ALL},fetch=FetchType.LAZY,targetEntity=Commodity.class,mappedBy="merchants")
	private List<Commodity> commodities;
	
	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Point getPoint() {
		return point;
	}

	public void setPoint(Point point) {
		this.point = point;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public Contacts getContacts() {
		return contacts;
	}

	public void setContacts(Contacts contacts) {
		this.contacts = contacts;
	}

	public Business getBusiness() {
		return business;
	}

	public void setBusiness(Business business) {
		this.business = business;
	}

	public MerchantType getType() {
		return type;
	}

	public void setType(MerchantType type) {
		this.type = type;
	}

	public List<ServerRelation> getServerRelations() {
		return serverRelations;
	}

	public void setServerRelations(List<ServerRelation> serverRelations) {
		this.serverRelations = serverRelations;
	}

	public List<Commodity> getCommodities() {
		return commodities;
	}

	public void setCommodities(List<Commodity> commodities) {
		this.commodities = commodities;
	}

}
